package com.csh.order.config;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson2.JSON;

import com.csh.order.entity.dto.LogGoodsAdmin;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.List;


@Component
public class JsRabbitMq {
    @RabbitListener(queues = "goods_Queue")
    public void onGoodsNum(String a,Message message, Channel channel) throws IOException {

        LogGoodsAdmin logGoodsAdmin = JSONArray.parseObject(a,LogGoodsAdmin.class);
        System.out.println(logGoodsAdmin);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
}
